<?php #//v.3.3.0

#///////////////////////////////////////////////////////
#//  COPYRIGHT 2004 Phpauction.org ALL RIGHTS RESERVED//
#///////////////////////////////////////////////////////

require('../includes/config.inc.php');
include "loggedin.inc.php";

#// Return if empty search
if($_POST['keyword'] == "") {
    Header("Location: unique_listusers.php");
    exit;
}
?>
<link rel='stylesheet' type='text/css' href='style.css' />
<link href="css/main.css" rel="stylesheet" type="text/css">
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0" class="titulo">
        <tr> 
          <td class="icono"><img src="images/users_icon2.gif" width="17" height="23" ></td>
          <td class="breadcrumbs"><p><span><?=$MSG_25_0010?></span>&nbsp;&gt;&gt;&nbsp;<?=$MSG_045?></p></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td align="center" valign="middle">&nbsp;</td>
  </tr>
    <tr> 
    <td align="center" valign="middle">

<TABLE WIDTH="95%" BORDER="0" CELLSPACING="0" CELLPADDING="0" ALIGN="CENTER" class="base" style="border:1px solid #ccc;">
<TR>
  <TD ALIGN=CENTER class=title><p><? print $MSG_045; ?></p></TD>
</TR>
<TR>
<TD>
  <table width="100%" border="0" cellspacing="0" cellpadding="0" align="right">
    <FORM NAME=search ACTION=unique_userssearch.php METHOD=POST>
    <tr>
      <td bgcolor="#eeeeee"> 
        <BR>
        <?=$MSG_5022?> <INPUT TYPE=text NAME=keyword SIZE=25>
        <input type=SUBMIT name=SUBMIT value="<?=$MSG_5023?>">
        <?=$MSG_5024?>
        <BR><BR>
      </td>
    </tr>
    </FORM>
  </table>
  </TD>
</TR>
<TR>
  <TD><TABLE WIDTH=100% CELPADDING=0 CELLSPACING=1 BORDER=0 ALIGN="CENTER" CELLPADDING="3">
      <?
        $query = "select count(id) as users from PHPAUCTIONXL_users
                        WHERE (name like '%$_POST[keyword]%' OR nick like '%$_POST[keyword]%' OR email like '%$_POST[keyword]%') AND accounttype='unique1'";
        $result = mysql_query($query);
        if(!$result) {
            print "$ERR_001<BR>$query<BR>".mysql_error();
            exit;
        }
        $num_usrs = mysql_result($result,0,"users");
        print "<TR BGCOLOR=#FFFFFF><TD COLSPAN=7><B>
                $num_usrs $MSG_301</B></TD></TR>";
        ?>
      <TR BGCOLOR="#FFFFC0">
        <TD ALIGN=CENTER> <B> <? print $MSG_293; ?> </B>  </TD>
        <TD ALIGN=CENTER> <B> <? print $MSG_294; ?> </B>  </TD>
        
        
       <!-- <TD ALIGN=CENTER> <B> <? print $MSG_295; ?> </B>  </TD>   -->
        
        
           
                    <TD ALIGN=LEFT width="10%"> <B> <? print $MSG_AJAX_ADMIN_USER_MANAGER_BIDS_REMAINING; ?> </B>  </TD>
                    
                    
        <TD ALIGN=CENTER> <B> <? print $MSG_296; ?> </B>  </TD>
        <TD ALIGN=LEFT width="10%"> <B> <? print strtoupper($MSG_25_0079); ?> </B>  </TD>
        <TD ALIGN=LEFT width="10%"> <B> <? print strtoupper($MSG_5290); ?> </B>  </TD>
        <TD ALIGN=LEFT> <B> <? print $MSG_297; ?> </B>  </TD>
      </TR>
        <?
        $query = "select * from PHPAUCTIONXL_users
                        WHERE ( name like '%$_POST[keyword]%' || nick like '%$_POST[keyword]%' || email like '%$_POST[keyword]%') AND accounttype='unique1'
                        order by nick";
        $result = mysql_query($query);
        //print $query;
        if(!$result){
            print "Database access error: abnormal termination<BR>$query<BR>".mysql_error();
            exit;
        }
        $num_users = mysql_num_rows($result);
        $i = 0;
        $bgcolor = "#FFFFFF";
        while($i < $num_users) {            
            if($bgcolor == "#FFFFFF") {
                $bgcolor = "#EEEEEE";
            } else {
                $bgcolor = "#FFFFFF";
            }            
            $id = mysql_result($result,$i,"id");
            $nick = mysql_result($result,$i,"nick");
            $name = mysql_result($result,$i,"name");
            $country = mysql_result($result,$i,"country");
            $email = mysql_result($result,$i,"email");
            $suspended = mysql_result($result,$i,"suspended");
            $newsletter = mysql_result($result,$i,"nletter");
            $bids_remaining = mysql_result($result,$i,"bids_remaining");
            print "        <TR BGCOLOR=$bgcolor>
            <TD>$nick</TD>
                    <TD>$name</TD>
                    <TD>$country</TD>
                    <TD><A HREF=\"mailto:$email\">$email</A></TD>
                    <TD align=center>";
                    if($newsletter == 1) {
                       // print "$MSG_030";
                    }
                    if($newsletter == 2) {
                      //  print "$MSG_029";
                    }
                    print "</TD><TD>";
                    if($suspended == 0) {
                        print "<B><FONT COLOR=green>$MSG_5291</B>";
                    }
                    if($suspended == 1) {
                        print "<B><FONT COLOR=violet>$MSG_5294</B>";
                    }
                    if($suspended == 9) {
                        print "<B><FONT COLOR=red>$MSG_5293</B>";
                    }
                    if($suspended == 10) {
                        print "<B><FONT COLOR=orange><A HREF=\"excludeuser.php?id=$id&offset=$offset\" class=\"nounderlined\">".$MSG_25_0136."</A>";
                    }
                    if($suspended == 8) {
                        print "<B><FONT COLOR=orange>$MSG_5292</B>
                               <BR>
                               <A HREF=resendemail.php?id=$id>$MSG_25_0074</A>
									";
				}
				if($suspended == 1) {
				print "
									<B><FONT COLOR=violet>$MSG_5294</B>
                               ";
                    }
                    print "</TD>";
                    print "<TD ALIGN=LEFT>
                    <A HREF=\"unique_deleteuser.php?id=$id&offset=$offset\" class=\"nounderlined\">$MSG_299</A><BR>
             
                    </TD>
                    </TR>";
                    $i++;
        }        
        print "</TABLE>";
        print "</TD></TR></TABLE>";
      ?>
    </TABLE>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
